# -*- coding: utf-8 -*-
from bottle import route, run,response,hook
import json, datetime

#解决跨域请求问题
@hook('after_request')
def enable_cors():
    response.headers['Access-Control-Allow-Origin'] = '*'


list_data=[


#第一组数据

[

    {
        "date":"2018-08-13 17:23:31",
        "x_value":465647,
        "title":"LPL夏季赛 OMG vs EDG /  FPX vs WE ",
        "y_name":"bilibili英雄联盟赛事"
    },
    {
        "date":"2018-08-13 17:23:31",
        "x_value":406309,
        "title":"双人现开赛疯狂实验篇-C组（直播）",
        "y_name":"暴雪游戏频道"
    },
    {
        "date":"2018-08-13 17:23:31",
        "x_value":218185,
        "title":"【滚】今天周一 打怪兽",
        "y_name":"两仪滚"
    }
],



#第二组数据


[
    {
        "date":"2018-08-13 17:32:17",
        "x_value":2501151,
        "title":"LPL夏季赛 OMG vs EDG /  FPX vs WE ",
        "y_name":"bilibili英雄联盟赛事"
    },
    {
        "date":"2018-08-13 17:32:17",
        "x_value":384494,
        "title":"双人现开赛疯狂实验篇-C组（直播）",
        "y_name":"暴雪游戏频道"
    },
    {
        "date":"2018-08-13 17:32:17",
        "x_value":208041,
        "title":"【滚】今天周一 打怪兽",
        "y_name":"两仪滚"
    }
],


#第三组数据


[
    {
        "date":"2018-08-13 18:11:53",
        "x_value":3322081,
        "title":"LPL夏季赛 OMG vs EDG /  FPX vs WE ",
        "y_name":"bilibili英雄联盟赛事"
    },

    {
        "date":"2018-08-13 18:11:53",
        "x_value":2818658,
        "title":"先吃鸡 后怪猎",
        "y_name":"痒局长"
    },
    {
        "date":"2018-08-13 18:11:53",
        "x_value":332307,
        "title":"双人现开赛疯狂实验篇-C组（直播）",
        "y_name":"暴雪游戏频道"
    },



]
                


                ];


i=0
@route('/readRank')
def server_static11():
    global i

    print(i)
    newmsg={}
    if i<len(list_data):
        data=list_data[i]
        
        newmsg['status']=0
        newmsg['data']=data
        i+=1
    if i>=len(list_data):
        newmsg['status']=0
        i=0
    return newmsg


run(host='localhost', port=8080)

